<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterTableKfMybankEntryAddStatus extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('mybank_entry', function (Blueprint $table) {
            $table->unsignedBigInteger('userId')->default(0)->after('id')
                  ->comment('当前记录principalMobile对应[kf_users.id]');

            $table->tinyInteger('preRegisterStatus')->default(0)->after('status')
                  ->comment('预入驻状态  0 - 审核中  1 - 成功 2 - 失败');

            $table->string('preRegisterFailReason')->default("")->after('preRegisterStatus')->comment('预入驻失败原因');

            $table->tinyInteger('registerStatus')->default(0)->after('preRegisterFailReason')
                  ->comment('激活状态  0 - 注册中  1 - 成功 2 - 失败');

            $table->string('registerFailReason')->comment("激活失败原因")->default("")->after('registerStatus');
            $table->string('arrangementNo', 64)->comment("合约号")->default("")->after('registerFailReason');

            $table->string('identificationCardFrontImg')->comment("身份证正面图")->default("")->after('type');
            $table->string('identificationCardBackImg')->comment("身份证背面图")->default("")
                  ->after('type');
            $table->string('identificationCardLife')->comment("身份证有效期")->default("")
                  ->after('type');
            $table->string('businessLicenseImg')->comment("营业执照图片")->default("")->after('type');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('mybank_entry', function (Blueprint $table) {
            $table->dropColumn('uid');
            $table->dropColumn('preRegisterStatus');
            $table->dropColumn('preRegisterFailReason');
            $table->dropColumn('registerStatus');
            $table->dropColumn('registerFailReason');
            $table->dropColumn('arrangementNo');
            $table->dropColumn('identificationCardFrontImg');
            $table->dropColumn('identificationCardBackImg');
            $table->dropColumn('businessLicenseImg');
            $table->dropColumn('identificationCardLife');
        });
    }
}
